/**
 * 
 */
package lablayer.model.MathComponents;

import lablayer.model.LabData;

/**
 *
 */
class Dummy implements MathComponent {
	private LabData result;
	
	private LabData data;
	
	private String componentName = "Данные";
	
	private String componentId = "1a";

	private LabData initData = null;
	
	public Dummy() {
		super();
		this.result = new LabData();
		this.initData = new LabData();
	}

	@Override
	public void calculate() {
		if (this.initData == null) {
			this.result = new LabData(data.getData());
		} else {
			this.result = new LabData(LabData.parseString(this.data.toString() + 
				';' + this.initData.toString()));
		}
	}
		
	@Override
	public String getComponentId() {
            return componentId;
	}
		
	@Override
	public String getComponentName() {
            return componentName;
	}

	@Override
	public LabData getData() {
            return data;
	}

	@Override
	public void setData(LabData data) {
            this.data = data;
	}

	@Override
	public LabData getResult() {
            return result;
	}

	@Override
	public void setParameter(String params, String values) {
		if (params.equals("initData")) {
			if (!values.equals("null")) {
				this.initData = new LabData(LabData.parseString(values));
			} else {
				this.initData = null;
			}
		}
	}

	@Override
	public LabData getInitData() {
		return this.initData;
	}
}
